package kr.hkit.powerjava.chther22.work;

public class Student implements Comparable<Student> {
	@Override
	public String toString() {
		return String
				.format("%4s %4s %4s%4s %4s %4s, %5.2f",
						stdNum, stdName, KorSocre, EngSocre, MathSocre,
						 totalscore(), totalAvg());
	}
	public Student(int stdNum, String stdName, int korSocre, int engSocre,
			int mathSocre) {
		this.stdNum = stdNum;
		this.stdName = stdName;
		KorSocre = korSocre;
		EngSocre = engSocre;
		MathSocre = mathSocre;
	}
	
	public Student(int i, String string) {
		// TODO Auto-generated constructor stub
	}
	public int getStdNum() {
		return stdNum;
	}
	public void setStdNum(int stdNum) {
		this.stdNum = stdNum;
	}
	public String getStdName() {
		return stdName;
	}
	public void setStdName(String stdName) {
		this.stdName = stdName;
	}
	public int getKorSocre() {
		return KorSocre;
	}
	public void setKorSocre(int korSocre) {
		KorSocre = korSocre;
	}
	public int getEngSocre() {
		return EngSocre;
	}
	public void setEngSocre(int engSocre) {
		EngSocre = engSocre;
	}
	public int getMathSocre() {
		return MathSocre;
	}
	public void setMathSocre(int mathSocre) {
		MathSocre = mathSocre;
	}
	private int stdNum;
	private String stdName;
	private int KorSocre;
	private int EngSocre;
	private int MathSocre;
	public int totalscore(){
		return KorSocre+EngSocre+MathSocre;
	}
	@Override
	public boolean equals(Object obj) {
		// TODO Auto-generated method stub
		return stdNum==((Student)obj).stdNum || stdName.equals(((Student)obj).stdName);
	}
	public double totalAvg(){
		return totalscore()/3.0;
	}
	@Override
	public int compareTo(Student o) {
		// TODO Auto-generated method stub
		return totalscore()-o.totalscore();
	}
}
